package com.cloud.monitor.sys.service;

import com.cloud.monitor.sys.entity.nodelayer.CPU;
import com.cloud.monitor.sys.mapper.NodeDataGetMapper;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * @author wurj
 * @time 2020/4/26 20:33
 * @description
 */
@Service
public class DataGetControllerService {
    @Autowired
    NodeDataGetMapper nodeDataGetMapper;

    @Scheduled(cron = "0/5 * * * * ?")
    @ApiOperation(value = "插入CPU监控数据")
    @RequestMapping(value = "/get1",method = RequestMethod.GET)
    public List<CPU> getCPU(){
        List<CPU> list=nodeDataGetMapper.getCPUUsage();
        return list;
    }
}
